package com.ruoyi.trainScript.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.trainScript.domain.BoleScrpitTrainRecord;
import com.ruoyi.trainScript.service.IBoleScrpitTrainRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 预测岗位训练记录Controller
 * 
 * @author wujiale
 * @date 2025-08-02
 */
@RestController
@RequestMapping("/trainScript/trainScript")
public class BoleScrpitTrainRecordController extends BaseController
{
    @Autowired
    private IBoleScrpitTrainRecordService boleScrpitTrainRecordService;

    /**
     * 查询预测岗位训练记录列表
     */
    @PreAuthorize("@ss.hasPermi('trainScript:trainScript:list')")
    @GetMapping("/list")
    public TableDataInfo list(BoleScrpitTrainRecord boleScrpitTrainRecord)
    {
        startPage();
        List<BoleScrpitTrainRecord> list = boleScrpitTrainRecordService.selectBoleScrpitTrainRecordList(boleScrpitTrainRecord);
        return getDataTable(list);
    }

    /**
     * 导出预测岗位训练记录列表
     */
    @PreAuthorize("@ss.hasPermi('trainScript:trainScript:export')")
    @Log(title = "预测岗位训练记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BoleScrpitTrainRecord boleScrpitTrainRecord)
    {
        List<BoleScrpitTrainRecord> list = boleScrpitTrainRecordService.selectBoleScrpitTrainRecordList(boleScrpitTrainRecord);
        ExcelUtil<BoleScrpitTrainRecord> util = new ExcelUtil<BoleScrpitTrainRecord>(BoleScrpitTrainRecord.class);
        util.exportExcel(response, list, "预测岗位训练记录数据");
    }

    /**
     * 获取预测岗位训练记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('trainScript:trainScript:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(boleScrpitTrainRecordService.selectBoleScrpitTrainRecordById(id));
    }

    /**
     * 新增预测岗位训练记录
     */
    @PreAuthorize("@ss.hasPermi('trainScript:trainScript:add')")
    @Log(title = "预测岗位训练记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BoleScrpitTrainRecord boleScrpitTrainRecord)
    {
        return toAjax(boleScrpitTrainRecordService.insertBoleScrpitTrainRecord(boleScrpitTrainRecord));
    }

    /**
     * 修改预测岗位训练记录
     */
    @PreAuthorize("@ss.hasPermi('trainScript:trainScript:edit')")
    @Log(title = "预测岗位训练记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BoleScrpitTrainRecord boleScrpitTrainRecord)
    {
        return toAjax(boleScrpitTrainRecordService.updateBoleScrpitTrainRecord(boleScrpitTrainRecord));
    }

    /**
     * 删除预测岗位训练记录
     */
    @PreAuthorize("@ss.hasPermi('trainScript:trainScript:remove')")
    @Log(title = "预测岗位训练记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(boleScrpitTrainRecordService.deleteBoleScrpitTrainRecordByIds(ids));
    }
}
